package tests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import communicationMessages.AddModeratorMessage;
import communicationMessages.Message;
import database.DB;
public class AddModeratorTest {
	
	
	@Test
	public void testRegularAddModerator()
	{
		String content = "admin" + Message.delimiter + "a" + Message.delimiter + "1" + Message.delimiter;
		Message msg = new AddModeratorMessage();
		msg.setContent(content);
		assertEquals(msg.getAnswer(), "addedModerator" + Message.delimiter + "admin"+Message.delimiter+"Success"+ Message.delimiter);
	}
	
	@Test
	public void testWrongParameterList()
	{
		Message msg = new AddModeratorMessage();
		msg.setContent("");
		String delimiter = Message.delimiter;
		assertEquals(msg.getAnswer(), "failed"+delimiter+"Add Moderator Message wrong format"+delimiter);
	}
	
	@Test
	public void testUserCantBeModerator()
	{
		String content = "admin" + Message.delimiter + "b" + Message.delimiter + "1" + Message.delimiter;
		Message msg = new AddModeratorMessage();
		msg.setContent(content);
		String delimiter = Message.delimiter;
		assertEquals(msg.getAnswer(), "addedModerator" + delimiter + "admin"+delimiter+"Failed"+delimiter);
	}

}
